---
title: Infra Settings
sidebarTitle: Settings
---

The `InfraSettings` object, usually defined in the `infra/settings.py` file is used to defines common settings used by your apps and resources.

Its not mandatory and doesn't serve any other purpose except to hold configuration used by workspace apps and resources. The values in the `InfraSettings` object can also be set using Environment variables or a `.env` file.

## Example

An example `InfraSettings` used by the `agent-infra-aws` template. View this file on [github](https://github.com/agno-agi/agent-infra-aws/blob/main/infra/settings.py)

```python infra/settings.py
from pathlib import Path

from agno.infra.settings import InfraSettings

#
# -*- Define infra settings using a InfraSettings object
# these values can also be set using environment variables or a .env file
#
infra_settings = InfraSettings(
    # Infra name: used for naming resources
    infra_name="ai",
    # Path to the infra root
    infra_root=Path(__file__).parent.parent.resolve(),
    # -*- Dev settings
    dev_env="dev",
    # -*- Dev Apps
    dev_app_enabled=True,
    dev_api_enabled=True,
    dev_db_enabled=True,
    # dev_jupyter_enabled=True,
    # -*- Production settings
    prd_env="prd",
    # -*- Production Apps
    prd_app_enabled=True,
    prd_api_enabled=True,
    prd_db_enabled=True,
    # -*- AWS settings
    # Region for AWS resources
    aws_region="us-east-1",
    # Availability Zones for AWS resources
    aws_az1="us-east-1a",
    aws_az2="us-east-1b",
    # Subnet IDs in the aws_region
    # subnet_ids=["subnet-xyz", "subnet-xyz"],
    #
    # -*- Image Settings
    #
    # Default repository for images
    image_repo="agno"
    # Build images locally
    build_images=False
    # Push images after building
    push_images=False
    # Skip cache when building images
    skip_image_cache=False
    # Force pull images in FROM
    force_pull_images=False
)
```

## Usage

Use the infra settings to

- Name resources
- Get the infra root path using `infra_settings.infra_root`

```python dev_resources.py
...
# -*- Streamlit running on port 8501:8501
dev_streamlit = Streamlit(
    name=f"{infra_settings.dev_key}-app",
    enabled=infra_settings.dev_app_enabled,
    ...
    # Read secrets from secrets/dev_app_secrets.yml
    secrets_file=infra_settings.infra_root.joinpath("infra/secrets/dev_app_secrets.yml")
)
```

- Hold AWS constants like `availability zone` and `subnets`

```python prd_resources.py
# -*- FastAPI running on ECS
prd_fastapi = FastApi(
    name=f"{infra_settings.prd_key}-api",
    enabled=infra_settings.prd_api_enabled,
    ...
    subnets=infra_settings.subnet_ids,
    ...
)

# -*- RDS Database Instance
prd_db = DbInstance(
    name=f"{infra_settings.prd_key}-db",
    enabled=infra_settings.prd_db_enabled,
    ...
    availability_zone=infra_settings.aws_az1,
    ...
)
```
